//
//  AppConfigure.h
//  Doctor1.0
//
//  Created by mk on 15/11/3.
//  Copyright (c) 2015年 cocoa-mk. All rights reserved.
//


#ifndef Doctor1_0_AppConfigure_h
#define Doctor1_0_AppConfigure_h

#define myAppKey @"1001032594"

#define alerTitle @"友情提示"
#define MAILID @"service@mingyihz.com"
#define WEIXINID @"mingyizhudao"
#define WEIXINANME @"“名医主刀”"
#define PHONENUMBER @"400-119-7099"
#define isPhoneNumber @"((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)"
//#define BASEAPIURL @"http://192.168.31.240/MYZD"
//#define BASEAPIURL @"http://192.168.31.206/myzd"
//#define BASEAPIURL @"http://test.mingyizd.com"
//#define BASEAPIURL @"http://mingyizhudao.com"
//#define OSAPPV @"&os=ios&appv=3"

//  获取验证码 action_type 注册100   预约200  更改密码101
/**
 *
 1.iPhone5分辨率320x568，像素640x1136，@2x
 2.iPhone6分辨率375x667，像素750x1334，@2x
 3.iPhone6 Plus分辨率414x736，像素1242x2208，@3x
 iphone6为准
 */
#define DefaultDevicePx 750
#define DefaultDENSITY 2.0
#define DENSITY ([UIScreen mainScreen].bounds.size.width / (DefaultDevicePx / DefaultDENSITY))
#define MK(px) (px / DefaultDENSITY * DENSITY)
#define iS_iOS7_OR_iOS8 [UIDevice currentDevice].systemVersion.doubleValue >= 7.0

#if __IPHONE_7_0 && __IPHONE_OS_VERSION_MAX_ALLOWED >=  __IPHONE_7_0
#define IS_RUNNING_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#else
#define IS_RUNNING_IOS7 NO
#endif

#define	PROPERTY_ASSIGN @property (nonatomic, assign)
#define	PROPERTY_ASSIGN_READONLY @property (nonatomic, assign, readonly)
#define	PROPERTY_COPY @property (nonatomic, copy)

//version
#define CurrentSystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]
#define NSVersionNumber_iOS_5_0 (CurrentSystemVersion >= 5.0)
#define NSVersionNumber_iOS_6_0 (CurrentSystemVersion >= 6.0)
#define NSVersionNumber_iOS_7_0 (CurrentSystemVersion >= 7.0)
#define NSVersionNumber_iOS_8_0 (CurrentSystemVersion >= 8.0)

//appSize
#define appScreenWidth [UIScreen mainScreen].bounds.size.width
#define appScreenHeight [UIScreen mainScreen].bounds.size.height


//frame
#define APP_SCREEN_BOUNDS   [[UIScreen mainScreen] bounds]
#define APP_STATUS_FRAME    [UIApplication sharedApplication].statusBarFrame
#define APP_CONTENT_WIDTH   (APP_SCREEN_BOUNDS.size.width)
#define APP_CONTENT_HEIGHT  (APP_SCREEN_BOUNDS.size.height-APP_STATUS_FRAME.size.height)

#define DEVICE_IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define DEVICE_IS_IPHONE4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define KEY_WINDOW  [[UIApplication sharedApplication] keyWindow]



#define iPhone_4     [UIScreen mainScreen].bounds.size.height == 480.0f
#define iPhone_5     [UIScreen mainScreen].bounds.size.height == 568.0f
#define iPhone_6     [UIScreen mainScreen].bounds.size.height == 667.0f
#define iPhone_6p    [UIScreen mainScreen].bounds.size.height == 736.0f



//hud提示相关
#define SetHUDFinishedText(obj) { [gApp.window bringSubviewToFront:gApp.appMBPHUB];  [gApp.appMBPHUB setDelegate:self]; gApp.appMBPHUB.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MBProgressHUD.bundle/success.png"]];  gApp.appMBPHUB.mode = MBProgressHUDModeCustomView;  gApp.appMBPHUB.labelText = obj;  [gApp.appMBPHUB hide:YES afterDelay:1.0]; }

#define SetHUDStartText(obj) { [gApp.window bringSubviewToFront:gApp.appMBPHUB];  gApp.appMBPHUB.labelText = obj;  [gApp.appMBPHUB show:YES]; }

#define SetHUDHidden  [gApp.appMBPHUB hide:YES]

#define SetHUDShowText(__OBJ__) { [gApp.window bringSubviewToFront:gApp.appMBPHUB];    gApp.appMBPHUB.mode = MBProgressHUDModeText;  gApp.appMBPHUB.labelText = __OBJ__; [gApp.appMBPHUB show:YES]; [gApp.appMBPHUB hide:YES afterDelay:1.5]; }

#define HUDShowRequestError(__OBJ__, __VIEW__)   { MBProgressHUD *failHud = [MBProgressHUD HUDForView:__VIEW__];   if (!failHud) { failHud = [[MBProgressHUD alloc] initWithView:__VIEW__];   [__VIEW__ addSubview:failHud]; }  failHud.mode = MBProgressHUDModeText; failHud.labelText = __OBJ__; failHud.margin = 15.f;  [failHud show:YES];  [failHud hide:YES afterDelay:1.5]; gApp.appMBPHUB.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MBProgressHUD.bundle/error.png"]]; }

#define Alert(title,msg,btnTitle)  [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:NSLocalizedString(btnTitle, nil) otherButtonTitles:nil, nil] show];

#define AlertDelegate(title,msg,btnTitle,otherBtnTitle) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:NSLocalizedString(btnTitle, nil) otherButtonTitles:NSLocalizedString(otherBtnTitle, nil), nil] show];

//text
#define TextNsString(textValue)  [textValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

#define UIFontWithSize(size) [UIFont systemFontOfSize:size]
#define UIFontWithBoldSize(size) [UIFont boldSystemFontOfSize:size]

//color
#define UIColorFromRGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
#define UIColorFromRGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define UIColorFrom16RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue &0xFF0000) >>16))/255.0 green:((float)((rgbValue &0xFF00) >>8))/255.0 blue:((float)(rgbValue &0xFF))/255.0 alpha:1.0]

#define defaultNavBackColor UIColorFromRGB(0x26, 0xb1, 0xa4)

#define UIImageWithPng(img) IMAGE_CONTENT(img, @"png")
#define UIImageWithJpg(img) IMAGE_CONTENT(img, @"jpg")

//string temp

#define INT_TO_STRING(i)    [NSString stringWithFormat:@"%d", i]
#define Obj_TO_Sting(obj)   [NSString stringWithFormat:@"%@", obj]
#define ObjIsNotNull(a)                 (a != nil && a != [NSNull null])
#define NullObjToString(a)              (ObjIsNotNull(a) ? Obj_TO_Sting(a) : @"")


#define GetNoWhiteSpaceString(str) [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]

#define stringIsEmpty(obj) (([GetNoWhiteSpaceString(obj) length]==0)||[obj isEqualToString:@""]||[obj isEqualToString:@"(null)"]||[obj isEqualToString:@"nil"])


#define RANDOM_INT(min, max) ((min) + random() % ((max+1) - (min)))


//set btn image
#define SetBtnBackGroundImages(obj01,obj02,obj03) { [obj01 setBackgroundImage:[UIImage imageNamed:obj02]  forState:UIControlStateNormal]; [obj01 setBackgroundImage:[UIImage imageNamed:obj03]  forState:UIControlStateHighlighted]; }
#define SetBtnImages(obj01,obj02,obj03) { [obj01 setImage:[UIImage imageNamed:obj02]  forState:UIControlStateNormal]; [obj01 setImage:[UIImage imageNamed:obj03]  forState:UIControlStateHighlighted]; }

//app

#define gApp                            ((AppDelegate*)[[UIApplication sharedApplication] delegate])
#define gProjConfig                     ((AppDelegate*)[[UIApplication sharedApplication] delegate]).projConfig


#define loadImageDefaule  [UIImage imageNamed:@"photo_loading_image_160.png"]
#define loadDoctorImageDefaule  [UIImage imageNamed:@"default_doctor.png"]
#endif











